from django.test import TestCase
from App_ReadNovel.Tool import TranslateTool
# Create your tests here.
from App_ReadNovel.models import  wordlist
from App_SearchNovel.models import Books
from App_User_SigninAndRegister.models import User


class testbook(TestCase):

    def testword(self):
        u1 = User.objects.create(userid=1,password="123",email="11@qq.com")
        u2 = User.objects.create(userid=2,password="123",email="11@qq.com")
        w1 = wordlist.objects.create(word="spider",mean="爬虫")
        w2 = wordlist.objects.create(word="word",mean="单词")
        u1.wordlist.add(w1)
        u1.wordlist.add(w2)
        u2.wordlist.add(w1)
        u2.wordlist.add(w2)

        User.objects.get(userid=1).wordlist.filter(word="sprider").delete()

        print(User.objects.get(userid=1).wordlist.filter(word="sprider")[0].mean)
        print(User.objects.get(userid=1).wordlist.all())
        print(User.objects.get(userid=2).wordlist.all())

